﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;

namespace MVCWeb.Models
{
  public class Breadcrumb
  {

    public Breadcrumb()
    {
    }

    private string buildHrefHtml(string url, string linkName)
    {
      string HrefHtml = "";
      HrefHtml = "<a href='" + url + "'>" + linkName + "</a>";
      return HrefHtml;
    }

    public override string ToString()
    {
      // this hard-coded list could come from BLL which comes from database
      Dictionary<string, string> data = new Dictionary<string, string>();
      data.Add("Home", "http://localhost:52242/Home");
      data.Add("Students", "http://localhost:52242/Student");
      data.Add("Details", "http://localhost:52242/Student/Details/1");

      StringBuilder sb = new StringBuilder();
      foreach (var obj in data)
      {
        sb.Append(" > " + buildHrefHtml(obj.Value, obj.Key));
      }
      return sb.ToString();
    }
  }
}
